import request from '@/utils/request'

export function getCart(id) {
  return request({
    url: '/api/cart/cart/getCart',
    method: 'get',
    params: {id: id}
  })
}

export function isCheckTrue(id) {
  return request({
    url: '/api/cart/cart/isCheckTrue',
    method: 'get',
    params: {id: id}
  })
}

export function getCartItem(id, token) {
  return request({
    url: '/api/cart/cart/getCartItem',
    method: 'get',
    params: {id: id, token: token}
  })
}

export function setCartItem(skuId, id, count) {
  return request({
    url: `/api/cart/cart/setCartItem`,
    method: 'get',
    params: {skuId: skuId, id: id, count: count}
  })
}

export function setCartItemCheck(id, skuId) {
  return request({
    url: `/api/cart/cart/setCartItemCheck`,
    method: 'get',
    params: {id: id, skuId: skuId}
  })
}

export function setCartItemCheckAll(id, check) {
  return request({
    url: `/api/cart/cart/setCartItemCheckAll`,
    method: 'get',
    params: {id: id, check: check}
  })
}

export function setCartItemCount(id, skuId, count) {
  return request({
    url: `/api/cart/cart/setCartItemCount`,
    method: 'get',
    params: {id: id, skuId: skuId, count: count}
  })
}

export function delCartItem(id, skuId) {
  return request({
    url: `/api/cart/cart/delCartItem`,
    method: 'get',
    params: {id: id, skuId: skuId}
  })
}

export function batchDelCartItem(id, skuId) {
  return request({
    url: `/api/cart/cart/batchDelCartItem`,
    method: 'post',
    data: skuId,
    params: {id: id}
  })
}
